package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import com.cnswhy.cloud.server.common.entity.enumeration.ExpressCompany;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2020-10-16
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_spell_order")
@ApiModel(value = "SpellOrder", description = "")
@AllArgsConstructor
public class SpellOrder extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "")
    @TableField("spell_id")
    @Excel(name = "")
    private Long spellId;

    @ApiModelProperty(value = "")
    @NotNull(message = "不能为空")
    @TableField("price_id")
    @Excel(name = "")
    private Long priceId;

    @ApiModelProperty(value = "")
    @NotNull(message = "不能为空")
    @TableField("customer_id")
    @Excel(name = "")
    private Long customerId;

    @ApiModelProperty(value = "")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "login_name", condition = LIKE)
    @Excel(name = "登录账号")
    private String loginName;

    /**
     * 1待支付2拼团中3拼团成功4拼团失败5组团失败
     */
    @ApiModelProperty(value = "1待支付2拼团中3拼团成功4拼团失败5组团失败")
    @TableField("status")
    @Excel(name = "状态", replace = {"待支付_1", "拼团中_2", "拼团成功_3", "拼团失败_4", "拼团解散_5",  "_null"})
    private Integer status;

    /**
     * 收货地址
     */
    @ApiModelProperty(value = "收货地址")
    @TableField("address_id")
    @Excel(name = "")
    private Long addressId;

    @ApiModelProperty(value = "")
    @TableField("product_id")
    @Excel(name = "")
    private Long productId;

    @ApiModelProperty(value = "")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "pay_order_num", condition = LIKE)
    @Excel(name = "支付单号")
    private String payOrderNum;

    /**
     * 1拼购券3支付宝2微信
     */
    @ApiModelProperty(value = "1拼购券3支付宝2微信")
    @TableField("pay_type")
    @Excel(name = "支付方式",replace = {"拼购券_1", "支付宝_2", "微信_3", "余额支付_4","未知_null"})
    private Integer payType;

    /**
     * 处理状态
     */
    @ApiModelProperty(value = "0待支付2待收货3完成4回购中5已回购")
    @TableField("send_status")
    @Excel(name = "处理状态",replace = {"待支付_0","待发货_1", "待收货_2", "完成_3", "回购中_4","已回购_5","无_null"})
    private Integer sendStatus;

    /**
     * 1回购2发货
     */
    @ApiModelProperty(value = "1回购2发货")
    @TableField("goods_type")
    @Excel(name = "回购/发货", replace = {"回购_1","发货_2","无_null"})
    private Integer goodsType;

    @ApiModelProperty(value = "")
    @TableField("cost_price")
    @Excel(name = "")
    private BigDecimal costPrice;

    @ApiModelProperty(value = "")
    @TableField("order_price")
    @Excel(name = "订单价格")
    private BigDecimal orderPrice;

    /**
     * 是否免中1是2否
     */
    @ApiModelProperty(value = "是否免中1是2否")
    @TableField("is_privilege")
    @Excel(name = "是否免中", replace = { "免中_1",  "必中_2", "未知_null"})
    private Integer isPrivilege;

    /**
     * 支付宝微信交易返回订单号
     */
    @ApiModelProperty(value = "支付宝微信交易返回订单号")
    @Length(max = 255, message = "支付宝微信交易返回订单号长度不能超过255")
    @TableField(value = "transaction_id", condition = LIKE)
    @Excel(name = "支付宝微信交易返回订单号")
    private String transactionId;

    /**
     * 预授权单号
     */
    @ApiModelProperty(value = "预授权单号")
    @Length(max = 100, message = "预授权单号长度不能超过100")
    @TableField(value = "auth_no", condition = LIKE)
    @Excel(name = "")
    private String authNo;

    /**
     * 付款userId
     */
    @ApiModelProperty(value = "付款userId")
    @Length(max = 100, message = "付款userId长度不能超过100")
    @TableField(value = "pay_user_id", condition = LIKE)
    @Excel(name = "")
    private String payUserId;

    /**
     * 预授转支付订单号
     */
    @ApiModelProperty(value = "预授转支付订单号")
    @Length(max = 50, message = "预授转支付订单号长度不能超过50")
    @TableField(value = "auth_pay_order_num", condition = LIKE)
    @Excel(name = "")
    private String authPayOrderNum;

    /**
     * 免中特权id
     */
    @ApiModelProperty(value = "免中特权id")
    @TableField("privilege_id")
    @Excel(name = "")
    private Long privilegeId;

    @ApiModelProperty(value = "")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "express_no", condition = LIKE)
    @Excel(name = "")
    private String expressNo;

    @ApiModelProperty(value = "")
    @TableField("express_company")
    @Excel(name = "")
    private ExpressCompany expressCompany;

    @ApiModelProperty(value = "")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "pre_topay_order", condition = LIKE)
    @Excel(name = "")
    private String preTopayOrder;

    /**
     * 清算日期
     */
    @ApiModelProperty(value = "清算日期")
    @Length(max = 20, message = "清算日期长度不能超过20")
    @TableField(value = "sett_date", condition = LIKE)
    @Excel(name = "清算日期")
    private String settDate;
    /**
     * 拼团订单
     */
    @ApiModelProperty(value = "拼团订单")
    @Length(max = 32, message = "拼团订单长度不能超过32")
    @TableField(value = "spell_order_id", condition = LIKE)
    @Excel(name = "拼团订单")
    private String spellOrderId;
    @TableField(value = "stock_id")
    private Long stockId;


    @Builder
    public SpellOrder(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long createUser, Long updateUser, 
                    Long spellId, Long priceId, Long customerId, String loginName, Integer status, 
                    Long addressId, Long productId, String payOrderNum, Integer payType, Integer sendStatus, Integer goodsType, 
                    BigDecimal costPrice, BigDecimal orderPrice, Integer isPrivilege, String transactionId, String authNo, String payUserId, 
                    String authPayOrderNum, Long privilegeId, String expressNo, ExpressCompany expressCompany, String preTopayOrder, String settDate, String spellOrderId) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createUser = createUser;
        this.updateUser = updateUser;
        this.spellId = spellId;
        this.priceId = priceId;
        this.customerId = customerId;
        this.loginName = loginName;
        this.status = status;
        this.addressId = addressId;
        this.productId = productId;
        this.payOrderNum = payOrderNum;
        this.payType = payType;
        this.sendStatus = sendStatus;
        this.goodsType = goodsType;
        this.costPrice = costPrice;
        this.orderPrice = orderPrice;
        this.isPrivilege = isPrivilege;
        this.transactionId = transactionId;
        this.authNo = authNo;
        this.payUserId = payUserId;
        this.authPayOrderNum = authPayOrderNum;
        this.privilegeId = privilegeId;
        this.expressNo = expressNo;
        this.expressCompany = expressCompany;
        this.preTopayOrder = preTopayOrder;
        this.settDate = settDate;
        this.spellOrderId = spellOrderId;
    }

}
